static void QuickSort(int[] arr, int low, int high)
{
    if (low >= high) return;
    var pivotIndex = Partition(arr, low, high);
    QuickSort(arr, low, pivotIndex - 1);
    QuickSort(arr, pivotIndex + 1, high);
}


static int Partition(int[] arr, int low, int high)
{
    var pivot = arr[high];
    var i = low - 1;
    for (var j = low; j < high; j++)
    {
        if (arr[j] >= pivot) continue;
        i++;
        (arr[i], arr[j]) = (arr[j], arr[i]);
    }

    (arr[i + 1], arr[high]) = (arr[high], arr[i + 1]);
    return i + 1;
}

int[] arr = { 10, 7, 8, 9, 1, 5 };
QuickSort(arr, 0, arr.Length - 1);
Console.WriteLine($"排序数组：{string.Join(" ", arr)}");